feat(video): replay recorded tracking data via VideoSourceInput.trackingDataUrl#10
Conversation
…ingDataUrl Add optional `trackingDataUrl` to VideoSourceInput. When set, the URL is fetched and passed to `createVideoSource` as `trackingData`, so the lens is driven by recorded tracking (camera pose, etc.) instead of live tracking — enabling recorded-environment previews of world-facing lenses. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Clarifying the concern here: if I would fetch the tracking data before Something like this: const trackingData = trackingDataUrl ? await fetchTrackingData(trackingDataUrl) : undefined;
if (autoplay) await videoInput.play();
res({...}); |
Fetch the tracking-data sidecar before videoInput.play() so the looping video does not advance before Camera Kit receives the source (which would offset replay tracking from the video timeline), and a failed fetch rejects before playback starts (no orphaned playing video). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Good catch — agreed, fixed in 5c1c0cd. The tracking data is now fetched before |
What
Adds an optional
trackingDataUrltoVideoSourceInput. When set, the URL is fetched and passed to@snap/camera-kit'screateVideoSourceastrackingData, so the lens is driven by recorded tracking (camera pose, etc.) instead of live tracking.Why
Enables previewing world-facing lenses from a recorded environment (e.g. a Lens Studio
.tdclip) — the core SDK already supportscreateVideoSource(video, { trackingData }), but the React wrapper had no way to pass it.Changes
types.ts— addVideoSourceInput.trackingDataUrl?: string(documented).internal/sourceUtils.ts— fetch the buffer increateCameraKitVideoSourceand forward it tocreateVideoSource; reject on fetch failure.internal/sourceUtils.test.ts— tests for pass-through, omitted, and fetch-failure.trackingDataUrl(URL, not a raw buffer) keepsVideoSourceInputa serializable/hashable descriptor, consistent with howurlis already handled and withuseApplySource's source memoization.Test
npm test(292 passing, incl. 3 new),npm run build,npm run typecheck, Prettier — all clean.🤖 Generated with Claude Code